//
//  ViewController.m
//  ZSAutoScrollHintLabelView-master
//
//  Created by safiri on 2018/6/21.
//  Copyright © 2018年 safiri. All rights reserved.
//

#import "ViewController.h"
#import "ZSAutoScrollHintLabelView.h"

@interface ViewController ()<ZSAutoScrollHintLabelViewDelegate>

@property (nonatomic ,strong) ZSAutoScrollHintLabelView *topScrollHintLabelView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configTopScrollHint];
}

- (void)configTopScrollHint {
    CGFloat height = 38;
    [self.topScrollHintLabelView setFrame:CGRectMake(0, -height, self.view.frame.size.width, height)];
    [self.view addSubview:self.topScrollHintLabelView];
    self.topScrollHintLabelView.contentText = @"我是跑马灯提示文字哦！ZSAutoScrollHintLabelView hello world";
    [UIView animateWithDuration:1 animations:^{
        CGRect frame = self.topScrollHintLabelView.frame;
        frame.origin.y = 50;
        self.topScrollHintLabelView.frame = frame;
    } completion:^(BOOL finished) {}];
}

- (void)autoScrollHintLabelViewClose {
    [UIView animateWithDuration:1 animations:^{
        CGRect frame = self.topScrollHintLabelView.frame;
        frame.origin.y = -frame.size.height;
        self.topScrollHintLabelView.frame = frame;
    } completion:^(BOOL finished) {
        [self.topScrollHintLabelView removeFromSuperview];
    }];
}
- (ZSAutoScrollHintLabelView *)topScrollHintLabelView {
    if (!_topScrollHintLabelView) {
        _topScrollHintLabelView = [[ZSAutoScrollHintLabelView alloc] init];
        _topScrollHintLabelView.delegate = self;
        _topScrollHintLabelView.trumpetImage = [UIImage imageNamed:@"main_topHintTrumpetImage"];
        _topScrollHintLabelView.closeButtonImage = [UIImage imageNamed:@"main_topHintCloseImage"];
        _topScrollHintLabelView.contentTextColor = [UIColor whiteColor];
        _topScrollHintLabelView.contentViewBackgroundColor = [UIColor redColor];
    }
    return _topScrollHintLabelView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
